Skip to content

Conversation

@bouwew
Copy link
Contributor

@bouwew bouwew commented Aug 23, 2025

Summary by CodeRabbit

  • Documentation
    • Updated CHANGELOG: added an "Ongoing" note for 0.4x about fixing disabled buttons on non-plus devices and corrected a broken Markdown link.
  • Chores
    • Internal maintenance of button handling for the plugwise USB integration; no user-visible functional changes in this release.

@coderabbitai
Copy link

coderabbitai bot commented Aug 23, 2025

Walkthrough

Added a documentation bullet in CHANGELOG.md and fixed a broken Markdown link. In custom_components/plugwise_usb/button.py, imported callback and added a no-op @callback method _handle_coordinator_update(self) -> None before async_press. No other logic or public interfaces changed.

Changes

Cohort / File(s) Summary
Documentation
CHANGELOG.md
Inserted a new bullet under the "Ongoing" section: "Fix disabled buttons for all non-plus devices." Fixed a broken Markdown link in the MAY 2022 [0.23.2] entry. No code changes.
Plugwise USB Button Entity
custom_components/plugwise_usb/button.py
Added callback import from Home Assistant core and introduced a new @callback method _handle_coordinator_update(self) -> None containing only a docstring. Method placed before async_press; no behavioral changes.

Sequence Diagram(s)

sequenceDiagram
  participant HA as Home Assistant
  participant Coord as DataUpdateCoordinator
  participant Btn as PlugwiseUSBButtonEntity

  HA->>Coord: trigger refresh / schedule update
  Coord-->>Btn: notify coordinator update
  rect rgba(200,230,255,0.25)
    note right of Btn: New @callback method accepts notifications
    Btn->>Btn: _handle_coordinator_update()
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • CoMPaTech
  • ArnoutD

Poem

I twitch my whiskers at the change,
A tiny callback hops in range,
Docs neat, links set to play,
I nibble code and bounce away. 🥕🐇

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between c18afda and 2741256.

📒 Files selected for processing (2)
  • CHANGELOG.md (2 hunks)
  • custom_components/plugwise_usb/button.py (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • custom_components/plugwise_usb/button.py
  • CHANGELOG.md
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-button

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@bouwew bouwew marked this pull request as ready for review August 23, 2025 08:08
@bouwew bouwew requested a review from a team as a code owner August 23, 2025 08:08
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
CHANGELOG.md (1)

321-323: Broken markdown link formatting

There’s a bracket/parenthesis mismatch breaking the link.

Apply this diff:

-- Smile bugfix: fixing [plugwise module 192](https://github.com/plugwise/python-plugwise/issues/192) and [Core Issue 72305](https://github.com/home-assistant/core/issues/72305)
-  via plugwise module [v0.18.5)[https://github.com/plugwise/python-plugwise/releases/tag/v0.18.5]
+- Smile bugfix: fixing [plugwise module 192](https://github.com/plugwise/python-plugwise/issues/192) and [Core Issue 72305](https://github.com/home-assistant/core/issues/72305)
+  via plugwise module [v0.18.5](https://github.com/plugwise/python-plugwise/releases/tag/v0.18.5)
🧹 Nitpick comments (1)
custom_components/plugwise_usb/button.py (1)

115-118: No-op coordinator callback: optional to keep, safe to remove

The empty _handle_coordinator_update is fine for buttons (no state to update). If the base class doesn’t rely on its presence, consider removing to avoid registering a no-op.

Apply this diff to remove it:

-    @callback
-    def _handle_coordinator_update(self) -> None:
-        """Handle updated data from the coordinator."""
-
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 24469bf and aa3b99d.

📒 Files selected for processing (2)
  • CHANGELOG.md (1 hunks)
  • custom_components/plugwise_usb/button.py (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
custom_components/plugwise_usb/button.py (4)
custom_components/plugwise_usb/number.py (1)
  • _handle_coordinator_update (166-180)
custom_components/plugwise_usb/sensor.py (1)
  • _handle_coordinator_update (223-242)
custom_components/plugwise_usb/binary_sensor.py (1)
  • _handle_coordinator_update (104-124)
custom_components/plugwise_usb/switch.py (1)
  • _handle_coordinator_update (141-156)
🔇 Additional comments (3)
CHANGELOG.md (1)

5-8: Changelog entry looks good and matches the PR intent

The new “Ongoing” section and bullet succinctly describe the change.

custom_components/plugwise_usb/button.py (2)

13-13: Importing callback is appropriate

Required for the new @callback method. No issues.


43-49: Verify feature gating covers “all non‑plus energy devices”

The energy reset button is currently gated on node_feature=NodeFeature.CIRCLE. Please confirm this feature is present on all non‑plus energy devices you intend to support (e.g., Circle, Stealth, Plug variants). If some non‑plus energy devices only expose NodeFeature.ENERGY, you may need to gate on NodeFeature.ENERGY instead, or broaden the condition to include multiple features to meet the PR objective while avoiding duplicates on Plus devices.

Would you like me to draft a follow-up patch that gates on NodeFeature.ENERGY and explicitly excludes Plus devices if needed?

@sonarqubecloud
Copy link

@bouwew bouwew requested review from ArnoutD and dirixmjm August 24, 2025 07:36
Copy link
Contributor

@dirixmjm dirixmjm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work, but may take a short while before button come enabled.

@bouwew bouwew merged commit 23626fe into main Aug 24, 2025
10 checks passed
@bouwew bouwew deleted the fix-button branch August 24, 2025 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants